package com.sky.mapper;


import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {


    /**
     * 批量保存套餐和菜品的关联关系
     * @param setmealDishes
     */
    void insertBatch(List<SetmealDish> setmealDishes);

    /**
     * 根据套餐id删除套餐和菜品的关联关系
     * @param setmeal
     */
    @Delete("delete from mybatis.setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmeal);

    /**
     * 根据套餐的id查询对应的菜品
     * @param setmealId
     * @return
     */
    @Select("select * from mybatis.setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getDishBySetmealId(Long setmealId);

    List<Long> getSetmealIdsDishIds(List<Long> ids);
}
